<%--
  Created by IntelliJ IDEA.
  User: 31036
  Date: 2025/4/1
  Time: 16:50
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false" %>
<html>
<head>
    <title>申请退款页面</title>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- 请勿在项目正式环境中引用该 layui.css 地址 -->
    <link href="../../static/layui/css/layui.css" rel="stylesheet">
    <script src="../../static/js/jquery-1.8.3.js"></script>
</head>
<body>
<form class="layui-form" action="">
    <div class="layui-form-item">
        <label class="layui-form-label">订单id</label>
        <div class="layui-input-block">
            订单id:<input type="text" name="orderParkId" value="${orderPark.orderParkId}" lay-verify="required"
                          placeholder="订单id" autocomplete="off" class="layui-input">
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">支付方式</label>
        <div class="layui-input-block">
            支付方式:<input type="text" name="rechargeType" value="${orderPark.rechargeType}" lay-verify="required"
                            placeholder="订单id" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">退款金额</label>
        <div class="layui-input-block">
            退款金额:<input type="text" name="sumMoney" value="${orderPark.sumMoney}" lay-verify="required"
                            placeholder="订单id" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">退款原因</label>
        <div class="layui-input-block">
            退款原因:<input type="text" name="applyRemarks" lay-verify="required" placeholder="请输入退款原因"
                            autocomplete="off" class="layui-input">
        </div>
    </div>


    <div class="layui-form-item">
        <div class="layui-input-block">
            <button type="submit" class="layui-btn" lay-submit lay-filter="demo1">立即提交</button>
            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
        </div>
    </div>
</form>

<!-- 请勿在项目正式环境中引用该 layui.js 地址 -->
<script src="../../static/layui/layui.js"></script>
<script>
    layui.use(['form', 'laydate', 'util'], function () {
        var form = layui.form;
        var layer = layui.layer;
        var laydate = layui.laydate;
        var util = layui.util;

        // 自定义验证规则
        form.verify({
            pass: function (value) {
                if (!/(.+){6,12}$/.test(value)) {
                    return '密码必须 6 到 12 位';
                }
            }
        });

        // 指定开关事件
        form.on('switch(switchTest)', function (data) {
            layer.msg('开关 checked：' + (this.checked ? 'true' : 'false'), {
                offset: '6px'
            });
            layer.tips('温馨提示：请注意开关状态的文字可以随意定义，而不仅仅是 ON|OFF', data.othis)
        });

        // 提交事件
        form.on('submit(demo1)', function (data) {
            var field = data.field; // 获取表单字段值
            // 显示填写结果，仅作演示用
            layer.alert(JSON.stringify(field), {
                title: '当前填写的字段值'
            });
            // 此处可执行 Ajax 等操作
            $.ajax({
                url: "/apply/addApply",
                type: "post",
                contentType: "application/json;charset=utf-8",
                data: JSON.stringify(field),
                dataType: "json",
                success(res) {
                    if (res.code===200){
                        alert("提交申请，审核中，请稍等")
                        location.href="/sys/toOrderParkLiat"
                    }
                    if (res.code===100){
                        alert(res.msg)
                    }
                },
                error(){
                    alert("服务器错误")
                }

            })
            // …
            return false; // 阻止默认 form 跳转
        });

        // 日期
        laydate.render({
            elem: '#date'
        });

        // 普通事件
        util.on('lay-on', {
            // 获取验证码
            "get-vercode": function (othis) {
                var isvalid = form.validate('.demo-phone'); // 主动触发验证，v2.7.0 新增
                // 验证通过
                if (isvalid) {
                    layer.msg('手机号规则验证通过');
                    // 此处可继续书写「发送验证码」等后续逻辑
                    // …
                }
            }
        });
    });
</script>
</body>
</html>
